var netcore = require('../../../utils/network.js')
var tripleDes = require('../../../utils/CKCrypto.js')
var json = require('../../../utils/json_helper.js')

function invoke(contentText, contentType, eventType, sourcesNo, callBack){
  var params = new Map();
  params.set("contentText", contentText)
  params.set("contentType", contentType)
  params.set("eventType", eventType)
  params.set("sourcesNo", sourcesNo)
  netcore.requestPost("feedback/addFeedBack.do", params, function (success) {
    callBack(success)
  }, function (code, errMsg) {
    wx.showToast({
      title: errMsg,
      duration: 3000
    })
  })
}
//举报课程
function rePortCourse(courseNo,contentText,callBack){
  invoke(contentText, "0", "1", courseNo, callBack)
}
//具备视频
function rePortVideo(videoNo, contentText, callBack) {
  invoke(contentText, "1", "1", videoNo, callBack)
}
//举报教师
function rePortTeacher(userNo, contentText, callBack) {
  invoke(contentText, "2", "1", courseNo, callBack)
}
//反馈建议课程
function feedBackCourse(courseNo, contentText, callBack) {
  invoke(contentText, "0", "0", courseNo, callBack)
}
//反馈建议教师
function feedBackTeacher(userNo, contentText, callBack) {
  invoke(contentText, "2", "0", userNo, callBack)
}
//反馈建议视频
function feedBackVideo(videoNo, contentText, callBack) {
  invoke(contentText, "1", "0", videoNo, callBack)
}
module.exports = {
  rePortCourse: rePortCourse,
  rePortVideo: rePortVideo,
  rePortTeacher: rePortTeacher,
  feedBackCourse: feedBackCourse,
  feedBackTeacher: feedBackTeacher,
  feedBackVideo: feedBackVideo
}
